import {getCompanyList} from './api'
export const formItems = [
  {
    label: '组件ID',
    name: 'id',
    type: 'input-number',
    itemProps: {
      style: {width: '100%'}
    }
  },
  {
    label: '组件名称',
    name: 'title',
    type: 'input',
  },
  {
    label: '所属企业',
    name: 'company_id',
    type: 'select',
    asyncOptions: {
      api: getCompanyList,
      dataField: 'list',
      optionFields: {
        label: 'name',
        value: 'id',
      },
    }
  },
  {
    label: '组件类型',
    name: 'type',
    type: 'select',
    itemProps: {
      options: [
        {label:'图片',value: 'image'},
        {label:'视频',value: 'video'},
        {label:'文本',value: 'text'},
        {label:'弹窗',value: 'popup'}
      ]
    }
  },
  {
    label: '状态',
    name: 'status',
    span: 8,
    type: 'select',
    itemProps: {
      options: [
        {
          label: '上架',
          value: 1,
        },
        {
          label: '下架',
          value: 0,
        },
      ],
    },
  },
  {
    label: '创建日期',
    name: 'create_at',
    span: 8,
    valueFields: ['create_at_begin', 'create_at_end'],
    valueType: 'number',
    value: [],
    type: 'range-picker',
    format: 'YYYY-MM-DD',
  },
  {
    label: '所属栏目ID',
    name: 'category_id',
    type: 'input-number',
    itemProps: {
      style: {width: '100%'}
    }
  },
];

export const searchRules = {

};

export const columns = [
  {
    title: '操作',
    dataIndex: 'action',
    slots: { customRender: 'action' },
    width: 200,
  },
  // {
  //   title: '序号',
  //   dataIndex: 'id',
  //   key: 'id',
  // },
  {
    title: '组件ID',
    dataIndex: 'id',
    key: 'id',
    width: 200,
  },
  {
    title: '组件类型',
    dataIndex: 'type_name',
    key: 'type_name',
    width: 200,
  },
  {
    title: '所属企业',
    dataIndex: 'company_name',
    key: 'company_name',
    width: 200,
  },
  {
    title: '组件名称',
    dataIndex: 'title',
    key: 'title',
    width: 200,
  },
  {
    title: '模块排列顺序',
    dataIndex: 'sort',
    key: 'sort',
    width: 200,
  },
  {
    title: '创建时间',
    dataIndex: 'save_time',
    key: 'save_time',
    width: 200,
  },
  {
    title: '状态',
    dataIndex: 'status_name',
    key: 'status_name',
    width: 100,
  },
];
